﻿using System;
using System.Globalization;
using System.Windows.Data;
using StockholmsStad.Runtime.Serialization.DataContract.Enums;

namespace StockholmsStad.Windows.UI.Modules.Maintenance.Converters
{
    public class TimeBlockTypeToString : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(string))
                throw new InvalidOperationException("The target must be a string");

            if (value != null)
            {
                var val = (TimeBlockStatus)value;

                if (val == TimeBlockStatus.Bookable)
                    return "Aktiv";

                return "Paus";
            }
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
